import React from 'react'
import { Descriptions } from 'antd'
import styles from './loading.less'
import loadingImg from '@/assets/loading.png'

const SeniorCreditRisk = props => {
  if (!props.seniorData?.data)
    return (
      <div className={styles.loading}>
        <img src={loadingImg} />
      </div>
    )
  const {
    current_report_detail: CurrentReportDetail,
    behavior_report_detail: BehaviorReportDetail,
    apply_report_detail: ApplyReportDetail
  } = props.seniorData.data.credit.data.result_detail

  const { result_detail: resultDetail } = props.seniorData.data.risk.data

  const showIsYQ = code => {
    switch (code) {
      case '1':
        return '逾期'
      case '4':
        return '未逾期'
      default:
        return code
    }
  }

  return (
    <>
      <Descriptions title="信用现状报告详情" bordered column={4}>
        <Descriptions.Item label="网贷授信额度">
          {CurrentReportDetail?.C22180001}
        </Descriptions.Item>
        <Descriptions.Item label="网贷额度置信度">
          {CurrentReportDetail?.C22180002}
        </Descriptions.Item>
        <Descriptions.Item label="网络贷款类机构数">
          {CurrentReportDetail?.C22180003}
        </Descriptions.Item>
        <Descriptions.Item label="网络贷款类产品数">
          {CurrentReportDetail?.C22180004}
        </Descriptions.Item>
        <Descriptions.Item label="网络贷款机构最大授信额度">
          {CurrentReportDetail?.C22180005}
        </Descriptions.Item>
        <Descriptions.Item label="网络贷款机构平均授信额度">
          {CurrentReportDetail?.C22180006}
        </Descriptions.Item>
        <Descriptions.Item label="消金贷款类机构数">
          {CurrentReportDetail?.C22180007}
        </Descriptions.Item>
        <Descriptions.Item label="消金贷款类产品数">
          {CurrentReportDetail?.C22180008}
        </Descriptions.Item>
        <Descriptions.Item label="消金贷款类机构最大授信额度">
          {CurrentReportDetail?.C22180009}
        </Descriptions.Item>
        <Descriptions.Item label="消金贷款类机构平均授信额度">
          {CurrentReportDetail?.C22180010}
        </Descriptions.Item>
        <Descriptions.Item label="消金建议授信额度">
          {CurrentReportDetail?.C22180011}
        </Descriptions.Item>
        <Descriptions.Item label="消金额度置信度">
          {CurrentReportDetail?.C22180012}
        </Descriptions.Item>
      </Descriptions>
      <Descriptions
        title="行为报告详情"
        bordered
        style={{ marginTop: 20 }}
        column={4}
      >
        <Descriptions.Item label="贷款行为分">
          {BehaviorReportDetail?.B22170001}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月贷款笔数">
          {BehaviorReportDetail?.B22170002}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月贷款笔数">
          {BehaviorReportDetail?.B22170003}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月贷款笔数">
          {BehaviorReportDetail?.B22170004}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款笔数">
          {BehaviorReportDetail?.B22170005}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月贷款笔数">
          {BehaviorReportDetail?.B22170006}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月贷款总金额">
          {BehaviorReportDetail?.B22170007}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月贷款总金额">
          {BehaviorReportDetail?.B22170008}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月贷款总金额">
          {BehaviorReportDetail?.B22170009}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款总金额">
          {BehaviorReportDetail?.B22170010}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月贷款总金额">
          {BehaviorReportDetail?.B22170011}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款金额在1k及以下的笔数">
          {BehaviorReportDetail?.B22170012}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款金额在1k-3k的笔数">
          {BehaviorReportDetail?.B22170013}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款金额在3k-10k的笔数">
          {BehaviorReportDetail?.B22170014}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款金额在1w以上的笔数">
          {BehaviorReportDetail?.B22170015}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月贷款机构数">
          {BehaviorReportDetail?.B22170016}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月贷款机构数">
          {BehaviorReportDetail?.B22170017}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月贷款机构数">
          {BehaviorReportDetail?.B22170018}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月贷款机构数">
          {BehaviorReportDetail?.B22170019}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月贷款机构数">
          {BehaviorReportDetail?.B22170020}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月消金类贷款机构数">
          {BehaviorReportDetail?.B22170021}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月消金类贷款机构数">
          {BehaviorReportDetail?.B22170022}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月网贷类贷款机构数">
          {BehaviorReportDetail?.B22170023}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月网贷类贷款机构数">
          {BehaviorReportDetail?.B22170024}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月M0+逾期贷款笔数">
          {BehaviorReportDetail?.B22170025}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月M0+逾期贷款笔数">
          {BehaviorReportDetail?.B22170026}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月M0+逾期贷款笔数">
          {BehaviorReportDetail?.B22170027}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月M1+逾期贷款笔数">
          {BehaviorReportDetail?.B22170028}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月M1+逾期贷款笔数">
          {BehaviorReportDetail?.B22170029}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月M1+逾期贷款笔数">
          {BehaviorReportDetail?.B22170030}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月逾期总额">
          {BehaviorReportDetail?.B22170031}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月累计逾期金额">
          {BehaviorReportDetail?.B22170032}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月累计逾期金额">
          {BehaviorReportDetail?.B22170033}
        </Descriptions.Item>
        <Descriptions.Item label="正常还款订单数占贷款总订单数比例">
          {BehaviorReportDetail?.B22170034}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月失败扣款笔数">
          {BehaviorReportDetail?.B22170035}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月失败扣款笔数">
          {BehaviorReportDetail?.B22170036}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月失败扣款笔数">
          {BehaviorReportDetail?.B22170037}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月失败扣款笔数">
          {BehaviorReportDetail?.B22170038}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月失败扣款笔数">
          {BehaviorReportDetail?.B22170039}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月履约贷款总金额">
          {BehaviorReportDetail?.B22170040}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月履约贷款总金额">
          {BehaviorReportDetail?.B22170041}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月履约贷款总金额">
          {BehaviorReportDetail?.B22170042}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月履约贷款总金额">
          {BehaviorReportDetail?.B22170043}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月履约贷款总金额">
          {BehaviorReportDetail?.B22170044}
        </Descriptions.Item>
        <Descriptions.Item label="1个月履约笔数">
          {BehaviorReportDetail?.B22170045}
        </Descriptions.Item>
        <Descriptions.Item label="3个月履约笔数">
          {BehaviorReportDetail?.B22170046}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月履约贷款次数">
          {BehaviorReportDetail?.B22170047}
        </Descriptions.Item>
        <Descriptions.Item label="近12个月履约贷款次数">
          {BehaviorReportDetail?.B22170048}
        </Descriptions.Item>
        <Descriptions.Item label="近24个月履约贷款次数">
          {BehaviorReportDetail?.B22170049}
        </Descriptions.Item>
        <Descriptions.Item label="最近一次履约距今天数">
          {BehaviorReportDetail?.B22170050}
        </Descriptions.Item>
        <Descriptions.Item label="贷款行为置信度">
          {BehaviorReportDetail?.B22170051}
        </Descriptions.Item>
        <Descriptions.Item label="贷款已结清订单数">
          {BehaviorReportDetail?.B22170052}
        </Descriptions.Item>
        <Descriptions.Item label="信用贷款时⻓">
          {BehaviorReportDetail?.B22170053}
        </Descriptions.Item>
        <Descriptions.Item label="最近一次贷款放款时间">
          {BehaviorReportDetail?.B22170054}
        </Descriptions.Item>
      </Descriptions>
      <Descriptions title="申请报告详情" bordered style={{ marginTop: 20 }}>
        <Descriptions.Item label="申请准入分">
          {ApplyReportDetail?.A22160001}
        </Descriptions.Item>
        <Descriptions.Item label="申请准入置信度">
          {ApplyReportDetail?.A22160002}
        </Descriptions.Item>
        <Descriptions.Item label="申请命中机构数">
          {ApplyReportDetail?.A22160003}
        </Descriptions.Item>
        <Descriptions.Item label="申请命中消金类机构数">
          {ApplyReportDetail?.A22160004}
        </Descriptions.Item>
        <Descriptions.Item label="申请命中网络贷款类机构数">
          {ApplyReportDetail?.A22160005}
        </Descriptions.Item>
        <Descriptions.Item label="机构总查询次数">
          {ApplyReportDetail?.A22160006}
        </Descriptions.Item>
        <Descriptions.Item label="最近一次查询时间">
          {ApplyReportDetail?.A22160007}
        </Descriptions.Item>
        <Descriptions.Item label="近1个月机构总查询笔数">
          {ApplyReportDetail?.A22160008}
        </Descriptions.Item>
        <Descriptions.Item label="近3个月机构总查询笔数">
          {ApplyReportDetail?.A22160009}
        </Descriptions.Item>
        <Descriptions.Item label="近6个月机构总查询笔数">
          {ApplyReportDetail?.A221600010}
        </Descriptions.Item>
      </Descriptions>
      <Descriptions title="⻛险报告数据说明" bordered style={{ marginTop: 20 }}>
        <Descriptions.Item label="探查结果编码">
          {showIsYQ(resultDetail?.result_code)}
        </Descriptions.Item>
        <Descriptions.Item label="最大逾期金额">
          {resultDetail?.max_overdue_amt}
        </Descriptions.Item>
        <Descriptions.Item label="最⻓逾期天数">
          {resultDetail?.max_overdue_days}
        </Descriptions.Item>
        <Descriptions.Item label="最近逾期时间">
          {resultDetail?.latest_overdue_time}
        </Descriptions.Item>
        <Descriptions.Item label="当前逾期机构数">
          {resultDetail?.currently_overdue}
        </Descriptions.Item>
        <Descriptions.Item label="当前履约机构数">
          {resultDetail?.currently_performance}
        </Descriptions.Item>
        <Descriptions.Item label="异常还款机构数">
          {resultDetail?.acc_exc}
        </Descriptions.Item>
        <Descriptions.Item label="睡眠机构数">
          {resultDetail?.acc_sleep}
        </Descriptions.Item>
      </Descriptions>
    </>
  )
}

export default SeniorCreditRisk
